package com.example.studentgrades.service;

import com.example.studentgrades.entity.Course;
import com.example.studentgrades.repository.CourseRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CourseService {
    @Autowired
    private CourseRepository courseRepository;

    public List<Course> findAll() {
        return courseRepository.findAll();
    }

    public Course findById(Integer courseId) {
        return courseRepository.findById(courseId).orElse(null);
    }

    public void save(Course course) {
        courseRepository.save(course);
    }
}
